<?php
/**
 * RedXenon Framework
 * 
 * LICENSE
 * 
 * This source file is subject to the New BSD license that is bundled
 * with this package in the file LICENSE.txt
 * A copy of this license can be found in the world-wide-web at this URL:
 * http://www.redxenon.com/license/new-bsd-license.txt * 
 */

/* Abstract class */
require_once("RXAbstractFormElement.php");

/**
 * RedXenon Form (RXTextarea.php)
 * Defines methods to create Textarea elements
 * 
 * @category RedXenon
 * @package RedXenon_Form
 * @copyright Copyright (c) 2011 Red Xenon (http://www.redxenon.com)
 * @version $Id: RXTextarea.php 1.0 2011-05-02 $ 
 */
 class RXTextarea extends RXAbstractFormElement{
 	
 	/**
 	 * Number of columns of the Textarea
 	 * @var Integer
 	 */
 	private $cols;
 	
 	/**
 	 * Number of rows of the Textarea
 	 * @var Integer
 	 */
 	private $rows;
 	
 	/**
 	 * Value of the Textarea
 	 * @var String
 	 */
 	private $value;
 		
 	/**
 	 * Creates new instances of the Textarea element
 	 * @param String $name
 	 * @param String $value
 	 * @param Integer $cols
 	 * @param Integer $rows
 	 */
 	public function __construct($name = NULL, $value = NULL, $cols = NULL, $rows = NULL){
 		$this->value = $value;
 		$this->cols = $cols;
 		$this->rows = $rows;
 		parent::__construct($name);
 	}
 	
 	/**
 	 * Sets the column number
 	 * @param Integer $cols
 	 */
 	public function setCols($cols){
 		$this->cols = $cols;
 	}
 	
 	/**
 	 * Sets the row number
 	 * @param Integer $rows
 	 */
 	public function setRows($rows){
 		$this->rows = $rows;
 	}
 	
 	/**
 	 * Sets a new value
 	 * @param String $value
 	 */
 	public function setValue($value){
 		$this->value = $value;
 	}
 	
 	/**
 	 * Returns a HTML code that represents a Textare element
 	 * @return String
 	 */
 	public function getOuptut(){

 		$ret = '<textarea';
 		
 		if(isset($this->name))
 			$ret .= ' name="'.$this->name.'"';
 		if(isset($this->cols))
 			$ret .= ' cols="'.$this->cols.'"';
 		if(isset($this->rows))
 			$ret .= ' rows="'.$this->rows.'"';
 		 		
 		$ret .= '>';
 		
 		if(isset($this->value))
 			$ret .= $this->value;
 			
 		$ret .= '</textarea>';
 		return $ret;
 	}
 } 
 ?>